package com.meng.ioc_demo;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.meng.baselibrary.activity.BaseActivity;
import com.meng.baselibrary.dialog.AlertDialog;
import com.meng.ioclibrary.BindView;
import com.meng.ioclibrary.OnClick;
import com.meng.ioclibrary.ViewUtils;

/**
 * Created by Administrator on 2017/5/4.
 */

public class DialogTestAty extends BaseActivity {
    @BindView(R.id.testBtn)
    private Button mTestBtn;

    @Override
    protected void setContentView() {
        setContentView(R.layout.activity_dialog_test);
    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected void initView() {
        ViewUtils.inject(this);
    }

    @Override
    protected void initData() {

    }
    private AlertDialog dialog;
    @OnClick(R.id.testBtn)
    public void onClick(View view) {
        if(dialog == null){
            dialog = new AlertDialog.Builder(this)
                    .setContentView(R.layout.detail_comment_dialog)
                    .formBottom(true).fullWidth().create();
            // dialog去操作点击事件
            final EditText commentEt = dialog.getView(R.id.comment_editor);
            // 特有操作对象  getView方法   ListView  RecyclerView  CheckBox

            dialog.setOnclickListener(R.id.submit_btn, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(DialogTestAty.this,
                            commentEt.getText().toString().trim(), Toast.LENGTH_LONG).show();
                }
            });
        }
        dialog.show();
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}
